<template>
  <div class="box-container">
    <el-table
      :data="categoriesList"
      border
      style="width: 100%"
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
      row-key="cat_id"
    >
      <el-table-column
        prop="index"
        type=""
        label="#"
        width="48"
      />
      <el-table-column
        prop="cat_name"
        label="分类名称"
      />
      <el-table-column
        label="是否有效"
      >
        <template slot-scope="{ row }">
          <el-button v-if="!row.cat_deleted" class="check" type="success" icon="el-icon-check" circle />
        </template>
      </el-table-column>
      <el-table-column
        label="排序"
      >
        <template slot-scope="{ row }">
          <el-tag v-if="row.cat_level===0" size="mini" effect="dark">一级</el-tag>
          <el-tag v-else-if="row.cat_level===1" size="mini" effect="dark" type="success">二级</el-tag>
          <el-tag v-else size="mini" effect="dark" type="warning">三级</el-tag>
        </template>
      </el-table-column>
      <el-table-column
        label="操作"
      >
        <template>
          <el-button type="primary" size="mini" icon="el-icon-edit">编辑</el-button>
          <el-button type="danger" size="mini" icon="el-icon-delete">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  props: {
    categoriesList: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
    }
  },
  created() {
  },
  methods: {
  }
}
</script>

<style scoped lang='scss'>
.el-table{
  margin-top: 15px;
  font-size: 12px;
}
.check{
  padding: 0;
  font-size: 12px;
  border: none;
}
</style>
